package com.budwk.app.sqfw.controllers.admin;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.budwk.app.sqfw.models.Sqfw_formSummary;
import com.budwk.app.sqfw.services.SqfwDataStatisticForAdminService;
import com.budwk.app.sqfw.vo.dapingvo.SqfwDataStatisticInfoVO;
import com.budwk.app.sqfw.vo.dapingvo.SqfwDataStatisticPropDataInfoVO;
import com.budwk.app.sqfw.vo.dapingvo.SqfwDataStatisticStreetForAdminVO;
import com.budwk.starter.common.openapi.annotation.*;
import com.budwk.starter.common.result.Result;
import com.budwk.starter.log.annotation.SLog;
import lombok.extern.slf4j.Slf4j;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.*;

/**
 * @author LJT
 * @since 2023/10/24
 */
@IocBean
@At("/platform/sqfw/static")
@ApiDefinition(tag = "社区数据统计（后台管理系统）")
@Slf4j
public class SqfwDataStatisticForAdminController {

    @Inject
    private SqfwDataStatisticForAdminService sqfwDataStatisticForAdminService;

    /**
     * 辖区居民总计
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "辖区居民总计")
    @ApiResponses(
            implementation = Long.class
    )
    @SLog(tag = "辖区居民总计", value = "${args[0]}")
    @SaCheckLogin
    public Result<?> getResidentTotal() {
        return Result.data(sqfwDataStatisticForAdminService.getResidentTotal());
    }

    /**
     * 辖区商铺总计
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "辖区商铺总计")
    @ApiResponses(
            implementation = Long.class
    )
    @SLog(tag = "辖区商铺总计", value = "${args[0]}")
    @SaCheckLogin
    public Result<?> getShopTotal() {
        return Result.data(
                sqfwDataStatisticForAdminService.getShopTotal());
    }

    /**
     * 六类人员统计
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "六类人员统计")
    @ApiResponses(
            implementation = Long.class
    )
    @SLog(tag = "六类人员统计", value = "${args[0]}")
    @SaCheckLogin
    public Result<?> getStatisticSixTypeData() {
        return Result.data(
                sqfwDataStatisticForAdminService.getStatisticSixTypeData());
    }


    /**
     * 获取社区数据统计
     *
     * @param timeType
     * @return
     */
    @At("/getStatisticData")
    @Ok("json")
    @POST
    @ApiOperation(name = "社区数据统计")
    @ApiFormParams(
            value = {
                    @ApiFormParam(name = "timeType", example = "1696262400000,1696435200000", description = "统计时间", type = "String"),
                    @ApiFormParam(name = "statisticTime", example = "1696262400000,1696435200000", description = "统计时间", type = "String")
            }
    )
    @ApiResponses(
            implementation = SqfwDataStatisticStreetForAdminVO.class
    )
    @SLog(tag = "社区数据统计", value = "${args[0]},${args[1]}")
    @SaCheckLogin
    public Result<?> list(@Param("timeType") String timeType) {
        return Result.data(sqfwDataStatisticForAdminService.getDataStatistic(timeType));
    }

    /**
     * 获取用户数量
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "获取用户数量")
    @ApiResponses(
            implementation = Long.class
    )
    @SLog(tag = "获取用户数量", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getUserNum() {
        return Result.data(sqfwDataStatisticForAdminService.getUserNum());
    }

    /**
     * 累计数量统计
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "累计数量统计")
    @ApiResponses(
            implementation = Long.class
    )
    @SLog(tag = "累计数量统计", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getSummaryNum() {
        return Result.data(sqfwDataStatisticForAdminService.getSummaryNum());
    }

    /**
     * 本周数量统计
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "本周数量统计")
    @ApiResponses(
            implementation = Long.class
    )
    @SLog(tag = "本周数量统计", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getWeekNum() {
        return Result.data(sqfwDataStatisticForAdminService.getWeekNum());
    }

    /**
     * 各类数据占比（意义在于看网格员投入时间最多的板块）：饼图/环图
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "各类数据占比（意义在于看网格员投入时间最多的板块）：饼图/环图")
    @ApiResponses(
            implementation = SqfwDataStatisticPropDataInfoVO.class
    )
    @SLog(tag = "各类数据占比（意义在于看网格员投入时间最多的板块）：饼图/环图", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getCheckTypePropDataInfo() {
        return Result.data(sqfwDataStatisticForAdminService.getCheckTypePropDataInfo());
    }

    /**
     * 网格员数据采集情况排名
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "网格员数据采集情况排名")
    @ApiResponses(
            implementation = SqfwDataStatisticInfoVO.class
    )
    @SLog(tag = "网格员数据采集情况排名", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getGridPeopleCheckInfo() {
        return Result.data(sqfwDataStatisticForAdminService.getGridPeopleCheckInfo());
    }

    /**
     * 数据累计量+每日流入量
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "数据累计量+每日流入量")
    @ApiResponses(
            implementation = SqfwDataStatisticInfoVO.class
    )
    @SLog(tag = "数据累计量+每日流入量", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getTotalAndEveryDayDataInfo() {
        return Result.data(sqfwDataStatisticForAdminService.getTotalAndEveryDayDataInfo());
    }

    /**
     * 获取12345数据
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "获取12345数据")
    @ApiResponses(
            implementation = SqfwDataStatisticInfoVO.class
    )
    @SLog(tag = "获取12345数据", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getDynamicGovernmentServiceOnlineData() {
        return Result.data(sqfwDataStatisticForAdminService.getDynamicGovernmentServiceOnlineData());
    }

    /**
     * 获取安全巡查数据
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "获取安全巡查数据")
    @ApiResponses(
            implementation = SqfwDataStatisticInfoVO.class
    )
    @SLog(tag = "获取安全巡查数据", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getDynamicSafetyCheckData() {
        return Result.data(sqfwDataStatisticForAdminService.getDynamicSafetyCheckData());
    }

    /**
     * 获取社会治安数据
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "获取社会治安数据")
    @ApiResponses(
            implementation = SqfwDataStatisticInfoVO.class
    )
    @SLog(tag = "获取社会治安数据", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getDynamicSocietySecData() {
        return Result.data(sqfwDataStatisticForAdminService.getDynamicSocietySecData());
    }

    /**
     * 获取垃圾分类数据
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "获取垃圾分类数据")
    @ApiResponses(
            implementation = SqfwDataStatisticInfoVO.class
    )
    @SLog(tag = "获取垃圾分类数据", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getDynamicGarbageManageData() {
        return Result.data(sqfwDataStatisticForAdminService.getDynamicGarbageManageData());
    }

    /**
     * 获取安全隐患数据
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "获取安全隐患数据")
    @ApiResponses(
            implementation = SqfwDataStatisticInfoVO.class
    )
    @SLog(tag = "获取安全隐患数据", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getDynamicHiddenDangerData() {
        return Result.data(sqfwDataStatisticForAdminService.getDynamicHiddenDangerData());
    }

    /**
     * 整改统计：饼图（整改未整改）
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "整改统计：饼图（整改未整改）")
    @ApiResponses(
            implementation = SqfwDataStatisticInfoVO.class
    )
    @SLog(tag = "整改统计：饼图（整改未整改）", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getDynamicRectificationData() {
        return Result.data(sqfwDataStatisticForAdminService.getDynamicRectificationData());
    }

    /**
     * 社区活动：总量统计+滚动表格+参加人数
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "社区活动：总量统计+滚动表格+参加人数")
    @ApiResponses(
            implementation = SqfwDataStatisticInfoVO.class
    )
    @SLog(tag = "社区活动：总量统计+滚动表格+参加人数", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getDynamicCommunityActivitiesData() {
        return Result.data(sqfwDataStatisticForAdminService.getDynamicCommunityActivitiesData());
    }

    /**
     * 商铺分级管理：柱状图
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "社区活动：总量统计+滚动表格+参加人数")
    @ApiResponses(
            implementation = SqfwDataStatisticInfoVO.class
    )
    @SLog(tag = "社区活动：总量统计+滚动表格+参加人数", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getDynamicShopManageData() {
        return Result.data(sqfwDataStatisticForAdminService.getDynamicShopManageData());
    }

    /**
     * 重点人员管理：轮播展示数据
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "重点人员管理：轮播展示数据")
    @ApiResponses(
            implementation = SqfwDataStatisticInfoVO.class
    )
    @SLog(tag = "重点人员管理：轮播展示数据", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getDynamicImportPeopleData() {
        return Result.data(sqfwDataStatisticForAdminService.getDynamicImportPeopleData());
    }

    /**
     * 入户调查类型：垃圾分类宣传、消防安全宣传、入户安全巡查、特殊人员巡查
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "入户调查类型：垃圾分类宣传、消防安全宣传、入户安全巡查、特殊人员巡查")
    @ApiResponses(
            implementation = SqfwDataStatisticInfoVO.class
    )
    @SLog(tag = "入户调查类型：垃圾分类宣传、消防安全宣传、入户安全巡查、特殊人员巡查", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getHouseCheckTypeGroupData() {
        return Result.data(sqfwDataStatisticForAdminService.getHouseCheckTypeGroupData());
    }

    /**
     * 重点单位、场所：总量统计+滚动表格
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "重点单位、场所：总量统计+滚动表格")
    @ApiResponses(
            implementation = SqfwDataStatisticInfoVO.class
    )
    @SLog(tag = "重点单位、场所：总量统计+滚动表格", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getDynamicImportUnitData() {
        return Result.data(sqfwDataStatisticForAdminService.getDynamicImportUnitData());
    }

    /**
     * 覆盖街道
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "覆盖街道")
    @ApiResponses(
            implementation = Long.class
    )
    @SLog(tag = "覆盖街道", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getCoverStreet() {
        return Result.data(sqfwDataStatisticForAdminService.getCoverStreet());
    }

    /**
     * 覆盖社区
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "覆盖社区")
    @ApiResponses(
            implementation = Long.class
    )
    @SLog(tag = "覆盖社区", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getCoverCommunity() {
        return Result.data(sqfwDataStatisticForAdminService.getCoverCommunity());
    }

    /**
     * 覆盖居民
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "覆盖居民")
    @ApiResponses(
            implementation = Long.class
    )
    @SLog(tag = "覆盖居民", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getCoverResident() {
        return Result.data(sqfwDataStatisticForAdminService.getCoverResident());
    }

    /**
     * 覆盖企业商户
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "覆盖企业商户")
    @ApiResponses(
            implementation = Long.class
    )
    @SLog(tag = "覆盖企业商户", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getCoverEnterprises() {
        return Result.data(sqfwDataStatisticForAdminService.getCoverEnterprises());
    }

    /**
     * 覆盖户数
     */
    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "覆盖户数")
    @ApiResponses(
            implementation = Long.class
    )
    @SLog(tag = "覆盖户数", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getCoverHouseholds() {
        return Result.data(sqfwDataStatisticForAdminService.getCoverHouseholds());
    }

    /**
     * 详情查询
     */
    @At("/getSummaryDetail/{id}")
    @Ok("json")
    @GET
    @ApiOperation(name = "summary详情查询")
    @ApiResponses(
            implementation = Sqfw_formSummary.class
    )
    @SLog(tag = "summary详情查询", value = "${args[0]}")
    //@SaCheckLogin
    public Result<?> getSummaryDetail(String id) {
        return Result.data(sqfwDataStatisticForAdminService.getSummaryDetail(id));
    }
}
